/*
* @Author: An
* @Date:   2017-07-08 15:26:27
* @Last Modified by:   An
* @Last Modified time: 2017-07-08 16:04:43
*/

'use strict';

require('page/common/header/index.js');
require('page/common/nav/index.js');
require('./index.css');
var navSide = require('page/common/nav-side/index.js');
var _xj = require('util/xj.js');
var templateIndex = require('./index.string');
var _user = require('service/user-service.js');

// page逻辑
var page = {
	init : function() {
		this.onLoad();
	},
	onLoad : function() {
		// 初始化左侧菜单
		navSide.init({
			name : 'user-center'
		});
		this.loadUserInfo();
	},
	loadUserInfo : function() {
		var userHtml = '';
		_user.getUserInfo(function(res) {
			userHtml = _xj.renderHtml(templateIndex, res);
			$('.panel-body').html(userHtml);
		}, function(errMsg) {
			_xj.errorTips(errMsg);
		});
	}
};

$(function() {
	page.init();
});